home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 14 / Example 14.1 / mouse.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-29  |  1.2 KB  |  61 lines

  1. #ifndef _MOUSE
  2. #define _MOUSE
  3.  
  4. #include <d3dx9.h>
  5. #include <dinput.h>
  6. #include "debug.h"
  7. #include "intpoint.h"
  8. #include "mesh.h"
  9. #include "terrain.h"
  10.  
  11. struct RAY{
  12.     RAY();
  13.     RAY(D3DXVECTOR3 o, D3DXVECTOR3 d);
  14.  
  15.     //Our different intersection tests
  16.     float Intersect(MESHINSTANCE iMesh);
  17.     float Intersect(BBOX bBox);
  18.     float Intersect(BSPHERE bSphere);
  19.     float Intersect(ID3DXMesh* mesh);
  20.  
  21.     D3DXVECTOR3 org, dir;
  22. };
  23.  
  24.  
  25. class MOUSE : public INTPOINT{
  26.     friend class CAMERA;
  27.     public:
  28.         MOUSE();
  29.         ~MOUSE();
  30.         void InitMouse(IDirect3DDevice9* Dev, HWND wnd);
  31.         bool ClickLeft();
  32.         bool ClickRight();
  33.         bool WheelUp();
  34.         bool WheelDown();
  35.         bool Over(RECT dest);
  36.         bool PressInRect(RECT dest);
  37.         void Update(TERRAIN *terrain);
  38.         void Paint();
  39.         RAY GetRay();
  40.         void CalculateMappos(TERRAIN &terrain);
  41.         void DisableInput(int millisec);
  42.  
  43.         float m_fSpeed;
  44.         int m_iType;
  45.         INTPOINT m_mappos;
  46.         D3DXVECTOR3 m_ballPos;
  47.  
  48.     private:
  49.         IDirect3DDevice9* m_pDevice;
  50.         LPDIRECTINPUTDEVICE8 m_pMouseDevice;
  51.         DIMOUSESTATE m_mouseState;
  52.         IDirect3DTexture9* m_pMouseTexture;
  53.         ID3DXMesh *m_pSphereMesh;
  54.         LPD3DXSPRITE m_pSprite;
  55.         D3DMATERIAL9 m_ballMtrl;
  56.         RECT m_viewport;
  57.         DWORD m_dwBlock;
  58. };
  59.  
  60.  
  61. #endif